package com.itbaizhan.controller;

import com.itbaizhan.pojo.Student;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

@Controller
@RequestMapping("/student")
public class RestfulController {

//    @RequestMapping(value = "/{id}",method = RequestMethod.POST)
    @PostMapping("/{id}")
    public String addStudent(@PathVariable("id") int id, Student student){
        System.out.println("新增了学生 "+student);
        return "baizhan";
    }

//    @RequestMapping(value = "/{id}",method = RequestMethod.DELETE)
    @DeleteMapping("/{id}")
    public String deleteStudent(@PathVariable("id") int id){
        System.out.println("删除了学生 "+id);
        return "baizhan";
    }

    @RequestMapping(value = "/{id}",method = RequestMethod.PUT)
    public String updateStudent(@PathVariable("id") int id, Student student){
        System.out.println("修改了学生 "+student);
        return "baizhan";
    }

    @RequestMapping(value = "/{id}",method = RequestMethod.GET)
    public String findStudent(@PathVariable("id") int id){
        System.out.println("查找了学生 "+id);
        return "baizhan";
    }

}
